(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

2nd(cons(X, n__cons(Y, Z))) → activate(Y)
from(X) → cons(X, n__from(s(X)))
cons(X1, X2) → n__cons(X1, X2)
from(X) → n__from(X)
activate(n__cons(X1, X2)) → cons(X1, X2)
activate(n__from(X)) → from(X)
activate(X) → X

Rewrite Strategy: INNERMOST

(1) DependencyGraphProof (BOTH BOUNDS(ID, ID) transformation)

The following rules are not reachable from basic terms in the dependency graph and can be removed:
2nd(cons(X, n__cons(Y, Z))) → activate(Y)

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

from(X) → cons(X, n__from(s(X)))
from(X) → n__from(X)
activate(n__from(X)) → from(X)
activate(X) → X
cons(X1, X2) → n__cons(X1, X2)
activate(n__cons(X1, X2)) → cons(X1, X2)

Rewrite Strategy: INNERMOST

(3) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(4) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

from(X) → cons(X, n__from(s(X))) [1]
from(X) → n__from(X) [1]
activate(n__from(X)) → from(X) [1]
activate(X) → X [1]
cons(X1, X2) → n__cons(X1, X2) [1]
activate(n__cons(X1, X2)) → cons(X1, X2) [1]

Rewrite Strategy: INNERMOST

(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(6) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

from(X) → cons(X, n__from(s(X))) [1]
from(X) → n__from(X) [1]
activate(n__from(X)) → from(X) [1]
activate(X) → X [1]
cons(X1, X2) → n__cons(X1, X2) [1]
activate(n__cons(X1, X2)) → cons(X1, X2) [1]

The TRS has the following type information:
from :: s → n__from:n__cons
cons :: s → n__from:n__cons → n__from:n__cons
n__from :: s → n__from:n__cons
s :: s → s
activate :: n__from:n__cons → n__from:n__cons
n__cons :: s → n__from:n__cons → n__from:n__cons

Rewrite Strategy: INNERMOST

(7) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:
none

And the following fresh constants:

const, const1

(8) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

from(X) → cons(X, n__from(s(X))) [1]
from(X) → n__from(X) [1]
activate(n__from(X)) → from(X) [1]
activate(X) → X [1]
cons(X1, X2) → n__cons(X1, X2) [1]
activate(n__cons(X1, X2)) → cons(X1, X2) [1]

The TRS has the following type information:
from :: s → n__from:n__cons
cons :: s → n__from:n__cons → n__from:n__cons
n__from :: s → n__from:n__cons
s :: s → s
activate :: n__from:n__cons → n__from:n__cons
n__cons :: s → n__from:n__cons → n__from:n__cons
const :: n__from:n__cons
const1 :: s

Rewrite Strategy: INNERMOST

(9) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

const => 0
const1 => 0

(10) Obligation:

Complexity RNTS consisting of the following rules:

activate(z) -{ 1 }→ X :|: X >= 0, z = X
activate(z) -{ 1 }→ from(X) :|: z = 1 + X, X >= 0
activate(z) -{ 1 }→ cons(X1, X2) :|: X1 >= 0, X2 >= 0, z = 1 + X1 + X2
cons(z, z') -{ 1 }→ 1 + X1 + X2 :|: X1 >= 0, X2 >= 0, z = X1, z' = X2
from(z) -{ 1 }→ cons(X, 1 + (1 + X)) :|: X >= 0, z = X
from(z) -{ 1 }→ 1 + X :|: X >= 0, z = X

Only complete derivations are relevant for the runtime complexity.

(11) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1),0,[from(V, Out)],[V >= 0]).
eq(start(V, V1),0,[activate(V, Out)],[V >= 0]).
eq(start(V, V1),0,[cons(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(from(V, Out),1,[cons(X3, 1 + (1 + X3), Ret)],[Out = Ret,X3 >= 0,V = X3]).
eq(from(V, Out),1,[],[Out = 1 + X4,X4 >= 0,V = X4]).
eq(activate(V, Out),1,[from(X5, Ret1)],[Out = Ret1,V = 1 + X5,X5 >= 0]).
eq(activate(V, Out),1,[],[Out = X6,X6 >= 0,V = X6]).
eq(cons(V, V1, Out),1,[],[Out = 1 + X11 + X21,X11 >= 0,X21 >= 0,V = X11,V1 = X21]).
eq(activate(V, Out),1,[cons(X12, X22, Ret2)],[Out = Ret2,X12 >= 0,X22 >= 0,V = 1 + X12 + X22]).
input_output_vars(from(V,Out),[V],[Out]).
input_output_vars(activate(V,Out),[V],[Out]).
input_output_vars(cons(V,V1,Out),[V,V1],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [cons/3]
1. non_recursive : [from/2]
2. non_recursive : [activate/2]
3. non_recursive : [start/2]

#### Obtained direct recursion through partial evaluation
0. SCC is completely evaluated into other SCCs
1. SCC is partially evaluated into from/2
2. SCC is partially evaluated into activate/2
3. SCC is partially evaluated into start/2

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations from/2
* CE 6 is refined into CE [10]
* CE 5 is refined into CE [11]


### Cost equations --> "Loop" of from/2
* CEs [10] --> Loop 6
* CEs [11] --> Loop 7

### Ranking functions of CR from(V,Out)

#### Partial ranking functions of CR from(V,Out)


### Specialization of cost equations activate/2
* CE 7 is refined into CE [12,13]
* CE 8 is refined into CE [14]
* CE 9 is refined into CE [15]


### Cost equations --> "Loop" of activate/2
* CEs [13] --> Loop 8
* CEs [12,14,15] --> Loop 9

### Ranking functions of CR activate(V,Out)

#### Partial ranking functions of CR activate(V,Out)


### Specialization of cost equations start/2
* CE 2 is refined into CE [16,17]
* CE 3 is refined into CE [18,19]
* CE 4 is refined into CE [20]


### Cost equations --> "Loop" of start/2
* CEs [16,17,18,19,20] --> Loop 10

### Ranking functions of CR start(V,V1)

#### Partial ranking functions of CR start(V,V1)


Computing Bounds
=====================================

#### Cost of chains of from(V,Out):
* Chain [7]: 2
with precondition: [2*V+3=Out,V>=0]

* Chain [6]: 1
with precondition: [V+1=Out,V>=0]


#### Cost of chains of activate(V,Out):
* Chain [9]: 2
with precondition: [V=Out,V>=0]

* Chain [8]: 3
with precondition: [2*V+1=Out,V>=1]


#### Cost of chains of start(V,V1):
* Chain [10]: 3
with precondition: [V>=0]


Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [10] with precondition: [V>=0]
- Upper bound: 3
- Complexity: constant

### Maximum cost of start(V,V1): 3
Asymptotic class: constant
* Total analysis performed in 47 ms.

(12) BOUNDS(1, 1)